<?php

require_once 'smarty_lib/Smarty.class.php';
require_once 'lib/DBClass.php';
require_once 'lib/Account.php';
require_once 'lib/Halaman.php';

$smarty = new Smarty();
$acc = new Account();
$halaman = new Halaman();


$smarty->template_dir = 'template/';
$smarty->compile_dir = 'template_c/';


if(!$acc->validate_cookie()){
	$smarty->assign('error','Anda tidak mempunyai akses untuk membuka halaman ini');
	$smarty->display('fuf-login.html');
}else{
	
	$smarty->assign('cookie', $acc->get_cookie());
	$smarty->assign('page','addHalaman.html');
	$smarty->assign('title','Tambah Halaman');

	if (@$_GET['action'] == 'Publish') {
		$form = $_POST;
		$add = $halaman->addHalaman($form);
	}

	$smarty->display('dashboard.html');
}